package util

type BlockingPool struct {
	ch chan int
}

func NewBlockingPool(nn int) *BlockingPool {
	ch := make(chan int, nn)
	return &BlockingPool{ch: ch}
}

func (p *BlockingPool) Add(fn func(ch chan int)) {
	p.ch <- 1
	go fn(p.ch)
}
